# -*- coding: utf-8 -*-
__author__ = 'Paul'


from Products.bpContents.getImgTira import GetTiraImgs


# Import default Plone viewlet classes
from plone.app.layout.viewlets              import common as base

class SocialMediaBar(base.ViewletBase):


    def getImagen(self):
        """devuelve la url de una imagen"""
        urlI =  "++theme++Products.bpTheme/img/logo_bp.gif"
        listImg=self.getImages(self.context)
        if len(listImg)>0:
            urlI = listImg[0]["url"]

        return urlI

    def getURL(self):
        return self.context.absolute_url()

    def update(self):
        pass

    def getImages(self,obj):
        """Toda las imagenes
        """



        context = GetTiraImgs(obj)
        results = context.getTira()
        if results:
            return results
        else:
            return None